<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>量化运维管理系统</title>
    <link rel="icon" href="/static/img/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="Images/favicon.ico" type="image/x-icon" />
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/js/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/css/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/css/icon.css">
    <link rel="stylesheet" type="text/css" href="/static/css/demo.css">
    <link rel="stylesheet" href="/static/login/normalize.css">
    <link rel="stylesheet" href="/static/login/font-awesome.min.css">
    <link rel="stylesheet" href="/static/login/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/Styles/login.css">

    <script type="text/javascript">
        document.onkeydown = function (e) {
            var event = e || window.event;
            var code = event.keyCode || event.which || event.charCode;
            if (code == 13) {
                login();
            }
        }
        $(function () {
            $("input[name='username']").focus();
        });
        function cleardata() {
            $('#loginForm').form('clear');
        }
        function login() {
            if ($("input[name='username']").val() == "" || $("input[name='password']").val() == "") {
                $("#showMsg").html("用户名或密码为空，请输入");
                $("input[name='username']").focus();
            } else {
                //ajax异步提交
                $.ajax({
                    type: "POST",   //post提交方式默认是get
                    url: "/checklogin/",
                    data: $("#loginForm").serialize(),   //序列化
                    success: function(msg){
                         if(msg.accmsg){
                             $("#showMsg").html('<font color="green">' + msg.accmsg + '</font>');  //登录错误提示信息
                             location.href = '/index/';
                         }else{
                             $("#showMsg").html(msg.errmsg);  //登录提示信息
                         }
                    } 
                });
            }
        }
    </script>
</head>
<body style="text-align: center;margin-top: 10%">

<div class="demo" style="">
    <div class="container" >
        <div class="row">
            <div class="col-md-offset-3 col-md-6">
                <form class="form-horizontal" id="loginForm" method="post">
                    <span class="heading">itrade运维平台登录</span>
                    <div class="form-group" >
                        <i><img style="margin-bottom:18px" src="/static/login/man.png"/></i>
                        <input type="text" class="form-control" name="username" placeholder="用户名或电子邮件">
                    </div>
                    <div class="form-group help">
                        <i><img style="margin-bottom:18px" src="/static/login/lock.png"/></i>
                        <input type="password" class="form-control" id="inputPassword3" name="password" placeholder="密　码">
                    </div>
                    <div class="form-group">
                        <div style="padding:5px 0;text-align: center;color: red;" id="showMsg"></div>
                        <a type="submit" class="btn btn-default"  href="javascript:void(0)" onclick="login()">登录</a>
                    </div>
                </form>
            </div>
            </div>
        </div>
    </div>
    <div id="footer" style="text-align:center; height: 30px">
        <font color="#A4B9B9">Copyright &copy;2016-2017 HIKI 版权所有</font>
    </div>
</div>
</body>
</html>
